class toast {
	static msg(title, {
		icon = 1,
		duration = 1500
	}) {
		uni.showToast({
			title,
			icon: ['success', 'none'][icon],
			duration:duration
		})
	}
	static confirm({
		title = '提示',
		content,
		callback,
		confirmText = '好的',
		cancelText="取消",
	}) {
		uni.showModal({
			title,
			content,
			confirmText,
			cancelText,
			success(res) {
				if (res.confirm) {
					callback(true)
				} else if (res.cancel) {
					callback(false)
				}
			}
		})
	}
	static alert({
		title = '提示',
		content,
		callback
	}) {
		uni.showModal({
			title,
			content,
			showCancel: false,
			success(res) {
				callback(res)
			}
		})
	}
}

export default toast
